<script src="/static/Scripts/jquery-css3-vote-bar/js/index.js"></script>
<style>.news-time { /*position: absolute;*/ top: 0px; font-size: smaller; right: 0; color: #bbb; background: #FFF; }</style>
<div class="search-bar" style="float: none">
</div>
<table class="product-tab">
    <thead>
    <td width="10"></td>
    <td width="60" style="color: #FF4646;font-weight: bold;">流量编号</td>
    <td width="80">&nbsp;</td>
    <td align="center" width="120">
        <a id="sort-product-group-handle" class="arrows down" href="javascript:void(0);" style="color: #FF4646;font-weight: bold;">&nbsp;发布人</a></td>
    <td width="100">
        <a id="sort-product-group-handle" class="arrows down" href="javascript:void(0);" style="color: #FF4646;font-weight: bold;">流量套餐名称</a></td>
    <td width="220" align="center" style="color: #FF4646;font-weight: bold;">任务进度</td>
    <td width="50" style="text-align: right">
        <div class="util-clearfix" id="filter-piece-price"></div>
    </td>
</thead>
<!--priduct list start-->
<tbody id="product-list">
    {volist name='data.list' id='vo'}
    <tr>
        <td>
        </td>
        <td class="product-pic-item">
            <div id="ph-handle-1" class="pic" style="width: 52px; height: auto; *font-size: 30px;">
                <a class="picRind" style="display: block;">
                    <span class="hico type9 topt" title="流量任务" style="color: #FF4646;font-weight: bold;background: url();text-indent: 0;"><strong>{$vo.coding}</strong></span>
                </a>
            </div>
        </td>
        <td>
            <a class="site-title"></td>
        <td>
            <p>{$vo.user_name}</p>
        </td>
        <td>
            <p>{$vo.package_name}</p>
        </td>
        <td align="center">
            <div class="skillbar clearfix " data-percent="{$vo.progress}%">
                <div class="skillbar-title" style="background: #27ae60;">
                    <span>{$status[$vo['status']]}</span></div>
                <div class="skillbar-bar" style="background: #2ecc71;"></div>
                <div class="skill-bar-percent">{$vo.progress}%</div></div>
        </td>
        <td class="action-links">
            <div><a class="tl-action" href="javascript:void(0)" title="&nbsp;查看详情" onclick="BrushProducFlowDetail('{$vo.id}')">&nbsp;&nbsp;查看详情</a></div>
        </td>
    </tr>
    {/volist}
</tbody>
</table>
<div class="pagination clearfix" id="pagination">
    <input type="hidden" name="totalpage" class="totalpage" value="8" />
    <form name="paginationForm" method="post" action="/wsproduct/manageproduct/manageProductList.htm">
        <input class="gotopage-hide" type="hidden" name="page" value="" />
        <input name='_csrf_token_' type='hidden' value='sgly9lvlblr0'>
        <input type="hidden" name="action" value='' /></form>
    <div class="page-links clearfix">
        {$data.page}
    </div>
</div>
<script>//调用layer时返回的索引值
    var layerIndex = 0;
    var pageIndex = '1';

    $(function () {
        //创建 msgBox 对象 ("imghref": "/images/") 指定图片路径
        $.msgBox = new MsgBox({
            "imghref": "/static/images/"
        });
        //搜索
        $("#grouplist").val('');
        $("#selectValue").val('');
        $("#productState").val('');

        $("#btn-submit-m").click(function () {
//            var productState = $("#productState").val();
//            var grouplist = $("#grouplist").val();
            var selectValue = $("#selectValue").val();
//            var startTime = $("#startTime").val();
//            var endTime = $("#endTime").val();
//            if (grouplist == "time" && (startTime.length <= 0 || endTime.length <= 0)) {
//                layer.alert("请先选择时间!", 0);
//                return;
//            }

            jQuery('#ManageProductListView').showLoading();
            $.get("{:U('Task/myTask')}", {key: selectValue}, function (data) {
                $("#ManageProductListView").html(data); //这里是重点，右侧数据获取后要显示到div中
                jQuery('#ManageProductListView').hideLoading(); //任务执行成功，关闭进度条
            }, "text");
        });
    })

    $('#selectValue').val("{$Think.get.key}");

    function GetManageProductList(Index) {
        jQuery('#ManageProductListView').showLoading();
        var selectValue = $("#selectValue").val();
        var obj = {p: Index};
        if (selectValue != '') {
            obj.key = selectValue;
        }
        $.get("{:U('Task/flowHall')}", obj, function (data) {
            $("#ManageProductListView").html(data); //这里是重点，右侧数据获取后要显示到div中
            jQuery('#ManageProductListView').hideLoading(); //任务执行成功，关闭进度条
        }, "text");
    }

    //通知卖家改价
    function BrushProducFlowErr(productId) {
        var title = '异常任务';

        var index = $.layer({
            type: 1,
            title: title,
            shadeClose: false,
            maxmin: false,
            fix: false,
            area: ['960px', '820px'],
            page: {
                url: '../BrushProduc/BrushProducFlowErr?productId=' + productId,
            }

        });
    }

    function BrushProducFlowOver(productId) {

        $.ajax({
            url: "/BrushProduc/BrushProducFlowOver?productId=" + productId,
            type: "post",
            dataType: "json",
            //data: {
            //    productName: pt_title,
            //},
            success: function (data) {
                if (data.Statu == "ok") {
                    $.msgBox.showMsgOk(data.Msg);
                } else {
                    layer.alert(data.Msg, 3);
                }
                //重新加载数据
                GetManageProductList('1')

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {

                var errMsg = XMLHttpRequest.responseText;
                if (errMsg.indexOf('loginDetail()')) {
                    loginDetail();
                } else {
                    layer.msg("出错啦!请重试", 3, 8);
                }
            }
        })
    }

    function BrushProducFlowDetail(productId) {
        var title = '详细信息';
        var index = $.layer({
            type: 1,
            title: title,
            shadeClose: false,
            maxmin: false,
            fix: false,
            area: ['962px', '630px'],
            page: {
                url: "{:U('Task/details')}?id=" + productId,
            }

        });
    }

    function BrushProducFlowStarOrStop(productId) {

        $.ajax({
            url: "/BrushProduc/BrushProducFlowStarOrStop?productId=" + productId,
            type: "post",
            dataType: "json",
            //data: {
            //    productName: pt_title,
            //},
            success: function (data) {
                if (data.Statu == "ok") {
                    $.msgBox.showMsgOk(data.Msg);
                } else {
                    layer.alert(data.Msg, 3);
                }
                //重新加载数据
                GetManageProductList('1')

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {

                var errMsg = XMLHttpRequest.responseText;
                if (errMsg.indexOf('loginDetail()')) {
                    loginDetail();
                } else {
                    layer.msg("出错啦!请重试", 3, 8);
                }
            }
        })
    }

    function GotoPage() {
        var pageIndex = $("#gotoPageNum").val();
        GetManageProductList(pageIndex);
    }
</script>